/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.ArrayList;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import ads.similar.SimilarWords;
import ads.similar.Word;
import ads.similar.WordToolBox;

/**
 *
 * @author frama_000
 */
public class SearchWords {
    
    ArrayList<String> words;
    ArrayList<Word> bestMatches;
    
    long startTime;
    long endTime;
    
    public SearchWords() {
        startTime=System.currentTimeMillis();
        words = WordToolBox.getWordsFromFile("C:\\Users\\frama_000\\Documents\\SVN\\google\\Exbox\\src\\ads\\similar\\words.txt");
        endTime=System.currentTimeMillis();
        System.out.println("Word list created in "+(endTime-startTime)+" milliseconds");
    }

    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
     @Test
     public void hello() {
//         String s = "h";
//         System.out.println(s.substring(0, s.length()-1).length());
        startTime=System.currentTimeMillis();
         bestMatches = SimilarWords.findSimilarWords(words, "Bassi", 10);
        System.out.println("Best match list created in "+(endTime-startTime)+" milliseconds");
         for(Word w:bestMatches){
             System.out.println(w.getWord());
         }
//         String s1 = "hallo";
//         String s2= "vello";
//         int ld = SimilarWords.levenshteinDistance(s1, s2);
//         System.out.println(ld);
     }
}